const util = require("../../../../utils/util")

const domainName = getApp().globalData.domainName
const header = {'content-type':'application/x-www-form-urlencoded'}
const dataType = 'json'
const method = 'POST'
const responseType = 'text'
// pages/class_theory_test_rank/class_theory_test_rank.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    app_pic_url:domainName + '/static/images/app_imanges',
    exam_date_list:[],
  },


  // 查看该学员训练记录详情
  view_detail(e){
    // console.log('view_detail')
    let index = e.currentTarget.id
    var jg_stu_id = this.data.examinee_list[index].jg_stu_id
    var real_name = this.data.examinee_list[index].real_name
    wx.navigateTo({
      url:'/pages/exam_record_list/exam_record_list?jg_stu_id=' + jg_stu_id + '&stu_name=' + real_name
      
    })

  },



  // 加载参考人列表及考试情况
  load_examinee_list(jg_id, cert_id, exam_date){
    wx.request({
      url: domainName + '/load_examineeList_of_jg',
      data: {
        jg_id:jg_id,
        cert_id:cert_id,
        exam_date:exam_date,
      },
      dataType: dataType,
      enableCache: true,
      enableHttp2: true,
      enableQuic: true,
      header: header,
      method: method,
      responseType: responseType,
      timeout: 0,
      success: res => {
        this.setData({
          examinee_list:res.data.examinee_list
        })
      },
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    // wx.showLoading({
    //   title: '网络通讯中...',
    //   mask: false,
    // })
    console.log('options',options)
    let cert_id = options.cert_id
    let cert_name = options.cert_name
    let exam_date = options.exam_date
    let jg_id = options.jg_id
    this.load_examinee_list(jg_id, cert_id, exam_date)
    this.setData({
      cert_name:cert_name,
      exam_date:exam_date,
    })





    this.setData({
      windowHeight : wx.getSystemInfoSync().windowHeight,
      windowWidth : wx.getSystemInfoSync().windowWidth,
      today: util.formatDate(new Date()),
    })

  },


  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})